#pytorch cpp例子 编译参考: https://pytorch.org/cppdocs/


#libtorch各版本下载 :  https://blog.csdn.net/weixin_43742643/article/details/114156298
cd  /pubx/hook_mem_alloc/example/pytorch_cpp_01/

md5sum  --check libtorch-cxx11-abi-shared-with-deps-1.4.0+cpu.zip.md5sum
md5sumOk=$?
if [ ! $md5sumOk ] ;then
wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-1.4.0%2Bcpu.zip
unzip libtorch-cxx11-abi-shared-with-deps-1.4.0+cpu.zip
fi

#ls ./libtorch/lib/libtorch.so

#cmake -DCMAKE_PREFIX_PATH=./libtorch -S . -B build

#CMAKE_BUILD_TYPE:  Debug, Release, RelWithDebInfo , MinSizeRel
#    ref:  https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html
cmake -DCMAKE_BUILD_TYPE=Debug  -S . -B build
#cmake -DCMAKE_BUILD_TYPE=Release  -S . -B build
cd build ; make; cd -
ls -lh  `pwd`/build/dcgan
#-rwxrwxr-x 1 zz zz 356K  5月 27 14:46 ./dcgan

#下载 mnist数据集下载脚本
md5sum  --check download_mnist.py.md5sum
download_mnist__md5sumOk=$?
if [ ! $download_mnist__md5sumOk ] ; then
  wget https://raw.githubusercontent.com/pytorch/examples/b9f3b2ebb9464959bdbf0c3ac77124a704954828/cpp/tools/download_mnist.py
fi

#下载mnist数据集
python3 download_mnist.py -d ./data/

#运行dcgan:
#`pwd`/build/dcgan